package com.usian.controller;

import com.usian.feign.SearchItemFeign;
import com.usian.pojo.SearchItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/frontend/searchItem/")
@RestController
public class SearchItemController {

    @Autowired
    private SearchItemFeign searchItemFeign;

    /**
     * 首页导入
     * @return
     */
    @RequestMapping("/importAll")
    public boolean importAll(){
        return searchItemFeign.importAll();
    }

    /**
     * 查询商品信息
     * @param q
     * @param page
     * @param pageSize
     * @return
     */
    @RequestMapping("/list")
    public List<SearchItem> selectByQ(@RequestParam String q, @RequestParam(defaultValue = "1")Long page,
                                      @RequestParam(defaultValue = "10")Integer pageSize){
        return searchItemFeign.selectByQ(q,page,pageSize);
    }
}
